import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules ,longLimtVal} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据




export const columns: BasicColumn[] = [
   {
    title: '企业名称',
    align:"center",
    dataIndex: 'qymc'
   },
   {
    title: '合同编号',
    align:"center",
    dataIndex: 'htbh'
   },
   {
    title: '计收月份',
    align:"center",
    dataIndex: 'sfyf'
   },
   {
    title: '工人数',
    align:"center",
    dataIndex: 'grs'
   },
   {
    title: '工人行政费',
    align:"center",
    dataIndex: 'grgl'
   },
   {
    title: '工人行政费币种',
    align:"center",
    dataIndex: 'pz1'
   },
   {
    title: '厂房计费标准',
    align:"center",
    dataIndex: 'cfgl'
   },
   {
    title: '厂房面积',
    align:"center",
    dataIndex: 'cfmj'
   },
   {
    title: '厂房计费币种',
    align:"center",
    dataIndex: 'pz2'
   },
   {
    title: '外汇补差',
    align:"center",
    dataIndex: 'wfbc'
   },
   {
    title: '计费标准',
    align:"center",
    dataIndex: 'jfbz'
   },
   {
    title: '外汇补差币种',
    align:"center",
    dataIndex: 'pz3'
   },
   {
    title: '厂房租金',
    align:"center",
    dataIndex: 'cfzj'
   },
   {
    title: '计费面积',
    align:"center",
    dataIndex: 'jfmj'
   },
   {
    title: '厂房租金币种',
    align:"center",
    dataIndex: 'pz4'
   },
   {
    title: '其它费用',
    align:"center",
    dataIndex: 'qtfy'
   },
   {
    title: '其它费用币种',
    align:"center",
    dataIndex: 'pzQt'
   },
   {
    title: '费用合计(人民币)',
    align:"center",
    dataIndex: 'rzjs'
   },
   {
    title: '费用合计(港币)',
    align:"center",
    dataIndex: 'hzjs'
   },
   {
    title: '是否收滞纳金',
    align:"center",
    dataIndex: 'sznj',
     customRender: ({ text }) => {
       return text == 1 ? '是' : text == 0 ? '否' : '';
     },
   },
   {
    title: '滞纳金比例(%)',
    align:"center",
    dataIndex: 'scale'
   },
/*   {
    title: '收费金额',
    align:"center",
    dataIndex: 'sfje'
   },*/
/*   {
    title: '收款日期',
    align:"center",
    dataIndex: 'skqx',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '收款流水号',
    align:"center",
    dataIndex: 'skls'
   },*/
  {
    title: '是否结清',
    align:"center",
    dataIndex: 'isdeal',
    customRender:({text})=>{
      if(text=="1"){
        return "已结清";
      }else{
        return "未结清";
      }
    }
  },
   {
    title: '备注',
    align:"center",
    dataIndex: 'bz'
   },

];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "企业名称",
      field: 'qymc',
      component: 'JInput',
      colProps: {span: 6},
 	},
	{
      label: "合同编号",
      field: 'htbh',
      component: 'JInput',
      colProps: {span: 6},
 	},
  {
    label: '计收月份',
    field: 'sfyf',
    component: 'MonthPicker',
    componentProps:{
      showTime:false,
      valueFormat:"YYYY-MM",
      getPopupContainer: () => document.body,
    },
  },
  {
    label: "是否结清",
    field: 'isdeal',
    component: 'Select',
    colProps: {span: 6},
    componentProps:{
      options:[{label:"是",value:1},{label:"否",value:0}]
    }
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '企业名称',
    field: 'qymc',
    component: 'JSearchSelect',
    componentProps:{
      // isRadioSelection:true
      dict:"DB_QYZLB,MC,MC",
      async:true,
      pageSize:10,
    },
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入企业名称!'},
      ];
    },
  },
  {
    label: '合同编号',
    field: 'htbh',
    component: 'Select',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入合同编号!'},
          ];
     },
  },
  {
    label: '计收月份',
    field: 'sfyf',
    component: 'MonthPicker',
    componentProps:{
      showTime:false,
      valueFormat:"YYYY-MM",
      getPopupContainer: () => document.body,
    },
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入计收月份!'},
      ];
    },
  },
  {
    label: '港币汇率',
    field: 'currency',
    component:"Input",
    dynamicDisabled:true,
  },
  {
    label: '工人数',
    field: 'grs',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0
    },
    colProps: {span: 8},
    dynamicRules: ({model,schema}) => {
      return [
        { 
          validator: (_, value) => {
            return longLimtVal(value,14)
          },
        },
      ];
    },
  },
  {
    label: '工人行政费',
    field: 'grgl',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    colProps: {span: 8},
    dynamicRules: ({model,schema}) => {
      return [
        { 
          validator: (_, value) => {
            return longLimtVal(value,14)
          },
        },
      ];
    },
  },
  {
    label: '工人行政费币种',
    field: 'pz1',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:'money_type'
    },
    defaultValue:'人民币',
    colProps: {span: 8},
  },
  {
    label: '综合管理费',
    field: 'cfgl',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    colProps: {span: 8},
    dynamicRules: ({model,schema}) => {
      return [
        { 
          validator: (_, value) => {
            return longLimtVal(value,14)
          },
        },
      ];
    },
  },
  {
    label: '厂房面积',
    field: 'cfmj',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    colProps: {span: 8},
    dynamicRules: ({model,schema}) => {
      return [
        { 
          validator: (_, value) => {
            return longLimtVal(value,14)
          },
        },
      ];
    },
  },
  {
    label: '厂房计费币种',
    field: 'pz2',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:'money_type'
    },
    defaultValue:'人民币',
    colProps: {span: 8},
  },
  {
    label: '外汇补差',
    field: 'wfbc',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    colProps: {span: 8},
    dynamicRules: ({model,schema}) => {
      return [
        { 
          validator: (_, value) => {
            return longLimtVal(value,14)
          },
        },
      ];
    },
  },
  {
    label: '计费标准',
    field: 'jfbz',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    colProps: {span: 8},
    dynamicRules: ({model,schema}) => {
      return [
        { 
          validator: (_, value) => {
            return longLimtVal(value,14)
          },
        },
      ];
    },
  },

  {
    label: '外汇补差币种',
    field: 'pz3',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:'money_type'
    },
    defaultValue:'人民币',
    colProps: {span: 8},
  },
  {
    label: '厂房租金',
    field: 'cfzj',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    colProps: {span: 8},
    dynamicRules: ({model,schema}) => {
      return [
        { 
          validator: (_, value) => {
            return longLimtVal(value,14)
          },
        },
      ];
    },
  },
  {
    label: '计费面积',
    field: 'jfmj',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2,
    },
    colProps: {span: 8},
    dynamicRules: ({model,schema}) => {
      return [
        { 
          validator: (_, value) => {
            return longLimtVal(value,14)
          },
        },
      ];
    },
  },
  {
    label: '厂房租金币种',
    field: 'pz4',
    component: 'JDictSelectTag',
    defaultValue:'人民币',
    componentProps:{
      dictCode:'money_type'
    },
    colProps: {span: 8},
  },
  {
    label: '其他费用',
    field: 'qtfy',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    dynamicRules: ({model,schema}) => {
      return [
        { 
          validator: (_, value) => {
            return longLimtVal(value,14)
          },
        },
      ];
    },
  },
  {
    label: '其他费用币种',
    field: 'pzQt',
    component: 'JDictSelectTag',
    defaultValue:'人民币',
    componentProps:{
      dictCode:'money_type',

    },
  },
  {
    label: '费用合计(人民币)',
    field: 'rzjs',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    dynamicRules: ({model,schema}) => {
      return [
        { 
          validator: (_, value) => {
            return longLimtVal(value,14)
          },
        },
      ];
    },
  },
  {
    label: '费用合计(港币)',
    field: 'hzjs',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    dynamicRules: ({model,schema}) => {
      return [
        { 
          validator: (_, value) => {
            return longLimtVal(value,14)
          },
        },
      ];
    },
  },
  {
    label: '是否收滞纳金',
    field: 'sznj',
    component: 'JSwitch',
    componentProps: {
      options: ['1', '0'],
    },
  },
  {
    label: '滞纳金比例(%)',
    field: 'scale',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
    },
    dynamicRules: ({model,schema}) => {
      return [
        { 
          validator: (_, value) => {
            return longLimtVal(value,14)
          },
        },
      ];
    },
  },
  {
    label: '季度',
    field: 'jd',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0
    },

  },
  {
    label: '季度内容',
    field: 'jdnr',
    component: 'Input',
    dynamicDisabled:true,
  },
/*  {
    label: '收款日期',
    field: 'skqx',
    component: 'DatePicker',
  },*/
  {
    label: '备注',
    field: 'bz',
    component: 'InputTextArea',
    componentProps:{
      row:5,
      col:10,
    }
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
